Skip to content

Conversation

7h3-3mp7y-m4n
Copy link
Contributor

What this PR does:
Adds name_validation_scheme as a YAML config field and -name.validation_scheme as a CLI flag to configure the metric and label name validation mode. Supports legacy (default) and UTF-8 options.
Which issue(s) this PR fixes:
Fixes #6702
Follow Up #6733
Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@dosubot dosubot bot added go Pull requests that update Go code sync-vendor type/feature labels Jul 17, 2025
Signed-off-by: 7h3-3mp7y-m4n <[email protected]>
@7h3-3mp7y-m4n 7h3-3mp7y-m4n changed the title feat: add configurable name validation scheme (legacy or utf8 feat: add configurable name validation scheme (legacy or utf8) Jul 18, 2025
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/cortexproject/cortex/blob/master/pkg/cortex/configinit/init.go
also needs to be removed. And please remove the places where the package is imported

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also remove https://github.com/cortexproject/cortex/blob/master/pkg/cortex/configinit/init.go and its references.

Also fix lint then we are good to go!

@@ -146,7 +149,7 @@ func (c *Config) RegisterFlags(f *flag.FlagSet) {
f.BoolVar(&c.AuthEnabled, "auth.enabled", true, "Set to false to disable auth.")
f.BoolVar(&c.PrintConfig, "print.config", false, "Print the config and exit.")
f.StringVar(&c.HTTPPrefix, "http.prefix", "/api/prom", "HTTP path prefix for Cortex API.")

f.StringVar(&c.NameValidationScheme, "name.validation_scheme", "legacy", "Validation scheme for metric and label names. Set to utf8 to allow UTF-8 characters.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag name should be name.validation-scheme as we use - in the flag name and use _ in the config file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I'll make the changes :)

@7h3-3mp7y-m4n
Copy link
Contributor Author

I made a blunder, I'll raise a new PR with the changes, and I apologize for it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/M sync-vendor type/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make NameValidationScheme configurable
2 participants